package com.dingwen.treasure.manage.dto;

import com.dingwen.treasure.base.enums.GenderEnum;
import com.dingwen.treasure.base.convert.model.impl.AbstractBeanConvertImpl;
import com.dingwen.treasure.base.valid.ValidGroup;
import com.dingwen.treasure.manage.vo.SysUserVo;
import com.dingwen.treasure.model.entity.mybatisplus.SysUser;
import lombok.*;
import lombok.experimental.Accessors;
import lombok.extern.slf4j.Slf4j;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import java.time.LocalDateTime;


/**
 * 系统用户dto
 * 　@author dingwen
 * 　@date 2022/5/17$
 */
@Accessors(chain = true)
@AllArgsConstructor
@NoArgsConstructor
@Data
@Slf4j
@EqualsAndHashCode(callSuper = false)
public class SysUserDto extends AbstractBeanConvertImpl<SysUser, SysUserDto, SysUserVo> {

    /**
     * 主键ID: 数据库自增，已统一配置 </br>
     */
    @Null(message = "新增ID不需要转递", groups = {ValidGroup.Save.class})
    @NotNull(message = "编辑ID不能为空", groups = {ValidGroup.Modify.class})
    private Long id;

    /**
     * 用户名
     */
    private String username;

    /**
     * 昵称: 模糊匹配
     */
    private String nickname;

    /**
     * 性别枚举 {@link GenderEnum} </br>
     */
    private GenderEnum gender;

    /**
     * 登录开始时间
     */
    private LocalDateTime lastLoginTimeStart;

    /**
     * 登录结束时间
     */
    private LocalDateTime lastLoginTimeEnd;

    /**
     * PO ---> DTO
     * 持久化对象 ---> 数据传输对象
     *
     * @param sysUser P
     * @return {@link SysUserDto}
     */
    @Override
    public SysUserDto poToDto(SysUser sysUser) {
        log.info("测试自定义 PO ---> DTO的转换");
        return null;
    }
}


